extend ./layout/default

block main-content
  #profileForm
    h2 Basic information
    .breakline  
    p
      input.name(value="#{user.name}" readonly)
    p
      input.email(value="#{user.email}" readonly)
    p
      if user.company
        input.company(placeholder="company, organization" value="#{user.company}")
      else 
        input.company(placeholder="company, organization")
    p
      if user.description
        textarea.description(rows="5") #{user.description}
      else
        textarea.description(rows="5" placeholder="introduce yourself")
    button#submitProfile(type="submit" style="background-color: #274;text-align: center;") Save
    
  script.
    $('#submitProfile').click(function(){
      var company = $(".company").val()
      var description = $(".description").val()
      var avatar = $(".picture").val()
      $.post('/profile/edit',{company: company, description: description, avatar:avatar}, function(data){
        location.href = "/user/#{user.name}"
      })
    })
